﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Core.DS
{
    public static partial class classes
    {
        public static dynamic getStudentList(int start, int limit, int cid)
        {
            var sql = new Sql.SqlDataContext();
            var total = sql.DSClassStudent.Count(row => row.cid == cid);
            var result = (from s in sql.DSClassStudent
                          where s.cid == cid
                          orderby s.NO
                          select new
                          {
                              no = s.NO,
                              s.sid,
                              s.name,
                              sex = s.sex.toSex()
                          }).Skip(start).Take(limit);
            return new
            {
                success = true,
                total,
                result
            };
        }
    }
}
